home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / database / bdem22.zip / BDEMO013.TXT < prev    next >
Text File  |  1994-10-27  |  2KB  |  48 lines

  1. BUILDER TEXT FILE FUNCTIONS
  2.  
  3. No Matter What System I Am Writing, It ALWAYS Seems I Need to Read or
  4. Write CR/LF Delimited Text Files.  So..Included in the Builder Library
  5. are Four Functions That Allow You to Have FULL Access to Any CR/LF
  6. Delimited Text File.
  7.  
  8. For Example The Following Code Sample is All That is Required to Read and
  9. Display Your AUTOEXEC.BAT:
  10.  
  11.         PROCEDURE Main()
  12.           LOCAL nHandle, cRec
  13.  
  14.           nHandle := FOPEN( "C:\AUTOEXEC.BAT" )    // Low Level Open
  15.  
  16.           // Test for Open Error
  17.           IF FERROR() <> 0
  18.             MsgBox( { "DOS ERROR " + ALLTRIM( STR( FERROR() ) ),
  19.                     "Opening C:\AUTOEXEC.BAT" } )
  20.             RETURN
  21.           ENDIF
  22.  
  23.           FEof(.f.)            // Initialize End of File Test to False
  24.  
  25.           // Read AUTOEXEC.BAT Records and Display Until End of File
  26.           DO WHILE !FEof()
  27.             cRec := FGets( nHandle )     // Read the record
  28.             ? cRec
  29.           ENDDO
  30.  
  31.           // Close the File
  32.           FCLOSE( nHandle )
  33.           RETURN
  34.  
  35.  
  36. That's All There is To It!  And With the Introduction in Builder v2.0 of
  37. the fGetsR() Function, Which Reads Backwards, You Can Easily Create
  38. Routines Like the Builder TextView() Function.
  39.  
  40. Note That the Builder TextView() Function is NOT Mouse Aware!  It is One
  41. of the Few Functions that is Not.  This is Because the Mouse Pads for This
  42. Function Should Be on the Screen Borders, and the TextView() Function Does
  43. NOT Display Screen Borders!  If You Want Your TextView()'s to Be Mouse
  44. Aware, See the Sample "Hand Coded Section" When (If?) You Examine this
  45. Demo Progam Using Builder Called "Hand021()".
  46.  
  47. ** End of File
  48.